<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>通过style属性修改样式</title>
    <style>
        .box {
            border: 1px solid yellowgreen;
            width: 300px;
            height: 400px;

        }
    </style>
</head>
<body>
    <div class="box"></div>
    <script>
    <!-- 1.获取图片元素 -->
    const box = document.querySelector(".box")
    // 2.通过style属性修改样式 对象.style.属性名=属性值
    box.style.border = "3px solid yellow"
    box.style.width = "400px"
    box.style.margin ="auto"
    box.style.backgroundColor = "blue"
    
    
    

    

    </script>


    
</body>
</html>